<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ch="http://java.sun.com/jsf/composite/channel"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">

        <h:form>

            <p:panel header="Cannel Agent Reperence Book">
                <f:facet name="header" >
                    <p:outputLabel value="Cannel Agent Current Balance" />
                    <p:commandButton id="btnBack" value="Back" 
                                     action="/channel/channel_reports" style="float: right;"
                                     ajax="false">
                    </p:commandButton>
                </f:facet>
                <h:panelGrid>
                    <h:panelGrid columns="3" >
                        <p:commandButton value="Fill" ajax="false" ></p:commandButton> 
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton">
                            <p:printer target="reportPrint"  />
                        </p:commandButton>
                        <p:commandButton  ajax="false" value="Excel" styleClass="noPrintButton">
                            <pe:exporter type="xlsx" target="tbl1" fileName="channel_report_agent_details"  />
                        </p:commandButton>
                    </h:panelGrid> 
                </h:panelGrid>
                <p:panel id="reportPrint" styleClass="summeryBorder noBorder">
                    <p:dataTable value="#{institutionController.agencies}" var="a" id="tbl1" rowIndexVar="i">
                        <f:facet name="header">
                            <p:outputLabel value="#{sessionController.loggedUser.institution.name}" />
                            <br></br>
                            <p:outputLabel value="Agency Details" />
                            <br></br>
                            <p:outputLabel value="Print Time" />
                            <p:outputLabel value="#{commonController.currentDateTime}" >
                                <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a" />
                            </p:outputLabel>
                        </f:facet>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="No" />
                            </f:facet>
                            <p:outputLabel value="#{i+1}" />
                        </p:column>
                        <p:column sortBy="#{a.institutionCode}">
                            <f:facet name="header">
                                <p:outputLabel value="Agent Code" />
                            </f:facet>
                            <p:outputLabel value="#{a.institutionCode}" />
                        </p:column>
                        <p:column sortBy="#{a.name}">
                            <f:facet name="header">
                                <p:outputLabel value="Agent Name" />
                            </f:facet>
                            <p:outputLabel value="#{a.name}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="Address" />
                            </f:facet>
                            <p:outputLabel value="#{a.address}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="Phone" />
                            </f:facet>
                            <p:outputLabel value="#{a.phone}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="Fax" />
                            </f:facet>
                            <p:outputLabel value="#{a.fax}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="E-Mail" />
                            </f:facet>
                            <p:outputLabel value="#{a.email}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="C. P. Name" />
                            </f:facet>
                            <p:outputLabel value="#{a.contactPerson.name}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="C. P. Phone" />
                            </f:facet>
                            <p:outputLabel value="#{a.contactPerson.mobile}" />
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="C. P. E-Mail" />
                            </f:facet>
                            <p:outputLabel value="#{a.contactPerson.email}" />
                        </p:column>
                    </p:dataTable>
                </p:panel>

            </p:panel>

        </h:form>
    </ui:define>


</ui:composition>